package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDate;
import java.util.List;

@TableName("t_order")
public class OrderBean {
    /**订单id */
    @TableId(value = "pk_orderId",type = IdType.AUTO)
    private Integer id;

    /**收货人 */
    @TableField("o_consignee")
    private String consignee;

    /**收货地址 */
    @TableField("o_address")
    private String address;

    /**收货人电话 */
    @TableField("o_phone")
    private String phone;

    /**下单时间 */
    @TableField("o_date")
    private LocalDate orderDate=LocalDate.now();

    /**总价 */
    @TableField("o_sum")
    private Integer totalPrice;

    /**订单状态 */
    @TableField("o_status")
    private String status="未发货";

    /**下单用户id */
    @TableField("fk_userid")
    private Integer userId;

    /**用户对象 */
    @TableField(exist = false)
    private UserBean userBean;

    /**订单明细集合 */
    @TableField(exist = false)
    private List<OrderDetailBean> detailList;

    public OrderBean() {
    }

    public OrderBean(String consignee, String address, String phone, Integer totalPrice,Integer userId) {
        this.consignee = consignee;
        this.address = address;
        this.phone = phone;
        this.totalPrice=totalPrice;
        this.userId = userId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getConsignee() {
        return consignee;
    }

    public void setConsignee(String consignee) {
        this.consignee = consignee;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public LocalDate getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(LocalDate orderDate) {
        this.orderDate = orderDate;
    }

    public Integer getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Integer totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public UserBean getUserBean() {
        return userBean;
    }

    public void setUserBean(UserBean userBean) {
        this.userBean = userBean;
    }

    public List<OrderDetailBean> getDetailList() {
        return detailList;
    }

    public void setDetailList(List<OrderDetailBean> detailList) {
        this.detailList = detailList;
    }

    @Override
    public String toString() {
        return "OrderBean{" +
                "id=" + id +
                ", consignee='" + consignee + '\'' +
                ", address='" + address + '\'' +
                ", phone='" + phone + '\'' +
                ", orderDate=" + orderDate +
                ", totalPrice=" + totalPrice +
                ", status='" + status + '\'' +
                ", userId=" + userId +
                ", userBean=" + userBean +
                ", detailList=" + detailList +
                '}';
    }
}
